package com.punch.course.controller;

import com.punch.common.model.Result;
import com.punch.common.vo.course.IndexVO;
import com.punch.course.service.IndexService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@Api(value = "IndexController", tags = "首页管理Controller")
public class IndexController {

    @Resource
    private IndexService indexService;


    @GetMapping(value = "/app/index/category", produces = "application/json; charset=utf-8")
    @ApiOperation(value = "app首页分类", notes = "app首页分类", produces = "application/json")
    public Result<List<IndexVO>> categoryList() {
        return Result.succeed(indexService.categoryList());
    }

    @GetMapping(value = "/app/index/floor", produces = "application/json; charset=utf-8")
    @ApiOperation(value = "app首页楼层", notes = "app首页楼层", produces = "application/json")
    public Result<List<IndexVO>> floorList() {
        return Result.succeed(indexService.floorList());
    }

    @GetMapping(value = "/app/index/detail/{id}", produces = "application/json; charset=utf-8")
    @ApiOperation(value = "详情", notes = "app首页楼层", produces = "application/json")
    public Result<IndexVO> indexDetail(@PathVariable Long id) {
        return Result.succeed(indexService.indexDetail(id));
    }
}
